package trancations.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import trancations.dao.UserDao;

/**
 * @author wang fei
 * @date 2020-10-12 10:01
 */
@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    //转账的方法
    @Transactional
    public void countMoney(){

        //lucy少100
        userDao.reduceMoney();

        //模拟异常
        int i = 10/0;

        //mary多一百哦
        userDao.addMoney();

    }
}
